

// #include "read_local_file.h"

//#if 0

#ifndef __READ_LOCAL_FILE__H__
#define __READ_LOCAL_FILE__H__


#include "gw_ktj_api_config.h"
#include <stdint.h>


#if   F133_ktj_gw_app_v2_4_19_Enable   

//#define  nv_gw_msg_file_path      "/mnt/UDISK/iot_gw/data/gw_msg.dat" 
#define  nv_gw_ip_file_path         "/mnt/UDISK/iot_gw/data/cfg_dat/gateway.ini" 
#define  nv_gw_ip_bin_file_path     "/mnt/UDISK/iot_gw/data/cfg_dat/gw_ini.bin" 
#else
//#define  nv_gw_msg_file_path      "/mnt/UDISK/gw_plc/data/gw_msg.dat" 
#define  nv_gw_ip_file_path         "/mnt/UDISK/gw_plc/data/cfg_dat/gateway.ini" 
#define  nv_gw_ip_bin_file_path     "/mnt/UDISK/gw_plc/data/cfg_dat/gw_ini.bin" 
#endif 


// // "/mnt/UDISK/iot_gw/data/cfg_dat/gw_ini.bin" 配置的tcp服务器连接通道
enum gw_ini_bin_server_index
{ 	
	GW_INI_CH_main = 0,		      //路灯服务
	GW_INI_CH_north1,		      //连接到上行HW传感器服务器---
	GW_INI_CH_north2,
	GW_INI_CH_north3,
	GW_INI_CH_manager,            //小程序---管理服务器
	GW_INI_CH_MAX,

}; 




#define MAX_PLATFORM_NUM 	5 // 
#define MAX_GPIO_NUM        32

#pragma pack(1)

typedef struct {
	char direct;
	char on_level;
	unsigned short gpio;
	
	char name[16];
}gpio_def_t;

typedef struct {
	char ip[16];
	unsigned short port;
	unsigned char link_way;  // tcp/mqtt/udp ....
	unsigned char protocol;
	int heartbeast_time;
}platform_cfg_t;


typedef struct {
	char plc_uart[32];
	char setup_uart[32];
	char resv[32];      /////-------edit------加上这个数据就对上了---否则数据无法对应

	platform_cfg_t platform_cfg[MAX_PLATFORM_NUM];//第一组是服务器ip

	int node_workdata_report_interval;
	char log_screen;
	gpio_def_t gpio_tab[MAX_GPIO_NUM];

} gw_commu_t;



#pragma pack()


void read_local_data_cfg_dat(void );



//--------------获取服务器--ip------
//输入参数 ch服务器通道=== enum gw_ini_bin_server_index
char*  rlf_read_gw_ip( uint8_t ch  );
uint16_t  rlf_read_gw_port( uint8_t ch  );


//--------------获取平台服务器--ip------
void rlf_get_gw_main_platform_ip_port( char* ip_str,char* port_str );

//----------更改平台服务器--ip------
void rlf_set_gw_main_platform_ip_port( const char* ip_str,const char* port_str );




#endif     //-----__READ_LOCAL_FILE__H__-----




